//
//  ViewController.m
//  testTimer
//
//  Created by Binbin on 16/7/1.
//  Copyright © 2016年 Binbin. All rights reserved.
//

#import "ViewController.h"
#import "XBCell.h"

@interface ViewController () <UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) NSMutableArray   * data;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerNib:[UINib nibWithNibName:@"XBCell" bundle:nil] forCellReuseIdentifier:@"XBCell"];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100.f;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    XBCell * cell = [tableView dequeueReusableCellWithIdentifier:@"XBCell"];
    cell.endTimestamp = self.data[indexPath.row];
    return cell;
}



- (NSArray *)data    {
    if (!_data) {
        _data = [NSMutableArray new];
        NSDate * now = [NSDate date];
        NSNumber * nowTimeSp = @((long)[now timeIntervalSince1970]);
        for (int i =0; i< 60; i ++) {
            [_data addObject:@(nowTimeSp.longLongValue + 60*i)];
        }
    }
    return _data;
}

@end
